<%--
  Created by IntelliJ IDEA.
  User: 17126
  Date: 2022/3/19
  Time: 21:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>矩形计算页面</title>
</head>
<body>
<%--
Long = Double.parseDouble(S_long); 将传过来的字符串类型的数据Long转换为double类型,Width亦然
Double.parseDouble(); 此语句使用时需判断要转换的字符串是否为空,否则会报错,解决方法: if (S_long != null && S_width != null)
--%>
<% double value;
    double Long = 0;
    double Width = 0;
    String S_long = request.getParameter("S_Long");
    String S_width = request.getParameter("S_Width");
    if (S_long != null && S_width != null) {
        Long = Double.parseDouble(S_long);
        Width = Double.parseDouble(S_width);
    } else value = 0;
    value = Long * Width;
%>
长为:<%= Long%><br>
宽为:<%= Width%><br>
矩形面积为:<%= value%>
</body>
</html>
